From 79c99f382d20b6434622f752046f6c0489ac5f76 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Wed, 6 Jun 2018 14:23:52 -0600 Subject: [PATCH] Limit scope of variables and functions that are not meant to be shared. (#188) restrict unshared variables and functions to file scope. --- alan.cc | 4 ++-- an1.cc | 14 +++++++------- an1sym.h | 6 +++--- arcdist.cc | 6 +++--- bcr.cc | 4 ++-- brauniger_iq.cc | 2 +- bushnell.cc | 2 +- dg-100.cc | 4 ++-- duplicate.cc | 2 +- enigma.cc | 4 ++-- exif.cc | 6 +++--- explorist_ini.cc | 4 +++- garmin.cc | 4 ++-- garmin_device_xml.cc | 2 +- gdb.cc | 4 ++-- geo.cc | 8 ++++---- geojson.cc | 2 +- googledir.cc | 2 +- gopal.cc | 4 ++-- gpx.cc | 8 ++++---- gtm.cc | 14 +++++++------- gtrnctr.cc | 2 +- holux.cc | 2 +- igo8.cc | 6 +++--- inifile.cc | 2 +- interpolate.cc | 8 ++++---- itracku.cc | 6 +++--- kml.cc | 6 +++--- lmx.cc | 4 ++-- magproto.cc | 2 +- make-an1sym.pl | 6 +++--- mapfactor.cc | 2 +- mapsend.cc | 6 +++--- mapsource.cc | 10 +++++----- mtk_locus.cc | 2 +- mtk_logger.cc | 12 ++++++------ nmea.cc | 10 +++++----- ozi.cc | 4 ++-- pcx.cc | 2 +- pocketfms_wp.cc | 2 +- polygon.cc | 6 +++--- position.cc | 6 +++--- psitrex.cc | 4 ++-- radius.cc | 6 +++--- reverse_route.cc | 8 ++++---- saroute.cc | 18 +++++++++--------- shape.cc | 30 ++++++++++++++++-------------- skytraq.cc | 14 ++++++++------ smplrout.cc | 22 +++++++++++----------- sort.cc | 6 +++--- stackfilter.cc | 10 +++++----- subrip.cc | 2 +- tomtom.cc | 8 ++++++-- tpo.cc | 32 +++++++++++++++++--------------- v900.cc | 2 +- validate.cc | 4 ++-- vpl.cc | 2 +- wfff_xml.cc | 6 +++--- 58 files changed, 199 insertions(+), 187 deletions(-) diff --git a/alan.cc b/alan.cc index 8950e4ff2..5154e6128 100644 --- a/alan.cc +++ b/alan.cc @@ -175,8 +175,8 @@ enum { /**************************************************************************/ static gbfile* fin = nullptr, *fout = nullptr; -struct wprdata WPR; -struct trldata TRL; +static struct wprdata WPR; +static struct trldata TRL; static arglist_t wpr_args[] = { /* diff --git a/an1.cc b/an1.cc index ebbc89c3c..6719f62b7 100644 --- a/an1.cc +++ b/an1.cc @@ -53,7 +53,7 @@ typedef struct roadchange { char* name; } roadchange; -roadchange* roadchanges = nullptr; +static roadchange* roadchanges = nullptr; static arglist_t an1_args[] = { @@ -250,7 +250,7 @@ typedef struct { static an1_waypoint_record* Alloc_AN1_Waypoint(); -void Destroy_AN1_Waypoint(void* vwpt) +static void Destroy_AN1_Waypoint(void* vwpt) { an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt; @@ -269,7 +269,7 @@ void Destroy_AN1_Waypoint(void* vwpt) xfree(vwpt); } -void Copy_AN1_Waypoint(void** vdwpt, void* vwpt) +static void Copy_AN1_Waypoint(void** vdwpt, void* vwpt) { an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt; an1_waypoint_record* dwpt = Alloc_AN1_Waypoint(); @@ -295,12 +295,12 @@ static an1_waypoint_record* Alloc_AN1_Waypoint() static an1_vertex_record* Alloc_AN1_Vertex(); -void Destroy_AN1_Vertex(void* vvertex) +static void Destroy_AN1_Vertex(void* vvertex) { xfree(vvertex); } -void Copy_AN1_Vertex(void** vdvert, void* vvert) +static void Copy_AN1_Vertex(void** vdvert, void* vvert) { an1_vertex_record* vert = (an1_vertex_record*)vvert; an1_vertex_record* dvert = Alloc_AN1_Vertex(); @@ -322,14 +322,14 @@ static an1_vertex_record* Alloc_AN1_Vertex() static an1_line_record* Alloc_AN1_Line(); -void Destroy_AN1_Line(void* vline) +static void Destroy_AN1_Line(void* vline) { an1_line_record* line = (an1_line_record*)vline; xfree(line->name); xfree(vline); } -void Copy_AN1_Line(void** vdline, void* vline) +static void Copy_AN1_Line(void** vdline, void* vline) { an1_line_record* line = (an1_line_record*)vline; an1_line_record* dline = Alloc_AN1_Line(); diff --git a/an1sym.h b/an1sym.h index f13cfd557..2e33d3094 100644 --- a/an1sym.h +++ b/an1sym.h @@ -60,7 +60,7 @@ */ -struct defguid { +static struct defguid { GUID guid; const char* name; } default_guids[] = { @@ -708,7 +708,7 @@ struct defguid { }, }; -int FindIconByName(const char* name, GUID* guid) +static int FindIconByName(const char* name, GUID* guid) { unsigned int i = 0; for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) { @@ -720,7 +720,7 @@ int FindIconByName(const char* name, GUID* guid) return 0; } -int FindIconByGuid(GUID* guid, char** name) +static int FindIconByGuid(GUID* guid, char** name) { unsigned int i = 0; for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) { diff --git a/arcdist.cc b/arcdist.cc index 40a86378e..3b52e3bc1 100644 --- a/arcdist.cc +++ b/arcdist.cc @@ -153,7 +153,7 @@ arcdist_arc_disp_hdr_cb(const route_head*) arcdist_arc_disp_wpt_cb(nullptr); } -void +static void arcdist_process() { queue* elem, * tmp; @@ -267,7 +267,7 @@ arcdist_process() } } -void +static void arcdist_init(const char*) { char* fm; @@ -290,7 +290,7 @@ arcdist_init(const char*) } } -void +static void arcdist_deinit() { /* do nothing */ diff --git a/bcr.cc b/bcr.cc index b9321759b..9cfe5c834 100644 --- a/bcr.cc +++ b/bcr.cc @@ -242,7 +242,7 @@ bcr_wgs84_to_mercator(const double lat, const double lon, int* north, int* east) *east = E; } -void +static void bcr_mercator_to_wgs84(const int north, const int east, double* lat, double* lon) { *lat = 2 * (atan(exp(north / radius)) - M_PI / 4) / M_PI * (double)180; @@ -356,7 +356,7 @@ bcr_write_wpt(const Waypoint*) { } -void bcr_write_line(gbfile* fout, const QString& key, int* index, const QString& value) +static void bcr_write_line(gbfile* fout, const QString& key, int* index, const QString& value) { if (value.isEmpty()) { /* this is mostly used in the world of windows */ /* so we respectfully add a CR/LF on each line */ diff --git a/brauniger_iq.cc b/brauniger_iq.cc index 9996efa63..17d6c570f 100644 --- a/brauniger_iq.cc +++ b/brauniger_iq.cc @@ -46,7 +46,7 @@ typedef enum { st_sample_spd, num_states } state_t; -state_t state; +static state_t state; #if __cplusplus inline state_t operator++(state_t& rs, int) { diff --git a/bushnell.cc b/bushnell.cc index 4945aced9..7d16d2b67 100644 --- a/bushnell.cc +++ b/bushnell.cc @@ -42,7 +42,7 @@ typedef struct { const char* icon; } icon_mapping_t; -icon_mapping_t bushnell_icons[] = { +static icon_mapping_t bushnell_icons[] = { { 0x00, "Yellow Square"}, { 0x01, "Blue Grey Circle" }, { 0x02, "Yellow Diamond" }, diff --git a/dg-100.cc b/dg-100.cc index b98d63505..aa0c224fd 100644 --- a/dg-100.cc +++ b/dg-100.cc @@ -77,7 +77,7 @@ struct dg100_command { const char* text; /* Textual description for debugging */ }; -struct dg100_command dg100_commands[] = { +static struct dg100_command dg100_commands[] = { { dg100cmd_getfile, 2, 1024, 2, "getfile" }, /* the getfileheader answer has variable length, -1 is a dummy value */ { dg100cmd_getfileheader, 2, -1, 2, "getfileheader" }, @@ -89,7 +89,7 @@ struct dg100_command dg100_commands[] = { { dg100cmd_gpsmouse, 1, 0, 0, "gpsmouse" } }; -struct dg100_command dg200_commands[] = { +static struct dg100_command dg200_commands[] = { { dg100cmd_getfile, 2, 1024, 2, "getfile" }, /* the getfileheader answer has variable length, -1 is a dummy value */ { dg100cmd_getfileheader, 2, -1, 2, "getfileheader" }, diff --git a/duplicate.cc b/duplicate.cc index 0e2781999..afd7d76ba 100644 --- a/duplicate.cc +++ b/duplicate.cc @@ -95,7 +95,7 @@ addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode) return (tree); } -void +static void free_tree(btree_node* tree) { if (tree->left) { diff --git a/enigma.cc b/enigma.cc index 1988cd6c1..9fbf0ef01 100644 --- a/enigma.cc +++ b/enigma.cc @@ -81,7 +81,7 @@ rd_init(const QString& fname) file_in = gbfopen_le(fname, "rb", MYNAME); } -int32_t decToEnigmaPosition(double val) +static int32_t decToEnigmaPosition(double val) { int degrees = fabs(val); double frac = fabs(val) - degrees; @@ -91,7 +91,7 @@ int32_t decToEnigmaPosition(double val) return sign * (enigmadeg + enigmafrac); } -float enigmaPositionToDec(int32_t val) +static float enigmaPositionToDec(int32_t val) { int deg = abs(val) / 180000; int enigmafrac = abs(val) % 180000; diff --git a/exif.cc b/exif.cc index 06a1e5bbe..69eca6c80 100644 --- a/exif.cc +++ b/exif.cc @@ -133,8 +133,8 @@ typedef struct exif_app_s { static gbfile* fin, *fout; static queue exif_apps; static exif_app_t* exif_app; -const Waypoint* exif_wpt_ref; -time_t exif_time_ref; +static const Waypoint* exif_wpt_ref; +static time_t exif_time_ref; static char exif_success; static QString exif_fout_name; @@ -142,7 +142,7 @@ static char* opt_filename, *opt_overwrite, *opt_frame, *opt_name; static uint8_t writer_gps_tag_version[4] = {2, 0, 0, 0}; -arglist_t exif_args[] = { +static arglist_t exif_args[] = { { "filename", &opt_filename, "Set waypoint name to source filename", "Y", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "frame", &opt_frame, "Time-frame (in seconds)", "10", ARGTYPE_INT, "0", nullptr, nullptr }, { "name", &opt_name, "Locate waypoint for tagging by this name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, diff --git a/explorist_ini.cc b/explorist_ini.cc index 889aa2c02..472117a43 100644 --- a/explorist_ini.cc +++ b/explorist_ini.cc @@ -5,11 +5,13 @@ static inifile_t* inifile; static const char myname[] = "explorist"; -const char* +#ifdef DEAD_CODE_IS_REBORN +static const char* explorist_read_value(const char* section, const char* key) { return inifile_readstr(inifile, section, key); } +#endif static mag_info* explorist_ini_try(const char* path) diff --git a/garmin.cc b/garmin.cc index 2eeb9d802..49ae9c40f 100644 --- a/garmin.cc +++ b/garmin.cc @@ -443,7 +443,7 @@ static int lap_read_nop_cb(int, struct GPS_SWay**) // returns 1 if the waypoint's start_time can be found // in the laps array, 0 otherwise -unsigned int checkWayPointIsAtSplit(Waypoint* wpt, GPS_PLap* laps, int nlaps) +static unsigned int checkWayPointIsAtSplit(Waypoint* wpt, GPS_PLap* laps, int nlaps) { int result = 0; @@ -888,7 +888,7 @@ waypt_write_cb(GPS_PWay*) * If we're using smart names, try to put the cache info in the * description. */ -const char* +static const char* get_gc_info(Waypoint* wpt) { if (global_opts.smart_names) { diff --git a/garmin_device_xml.cc b/garmin_device_xml.cc index 800aa3a07..ca2a7546f 100644 --- a/garmin_device_xml.cc +++ b/garmin_device_xml.cc @@ -40,7 +40,7 @@ static char* mountpoint, *base, *path, *ext; static xg_callback device_s, id_s, path_s, ext_s, base_s, dir_s; jmp_buf gdx_jmp_buf; -void type_s(xg_string args, const QXmlStreamAttributes*) +static void type_s(xg_string args, const QXmlStreamAttributes*) { type = args.compare(QLatin1String("GPSData")); } diff --git a/gdb.cc b/gdb.cc index 348b56806..8e959c267 100644 --- a/gdb.cc +++ b/gdb.cc @@ -182,7 +182,7 @@ disp_summary(const gbfile* f) static char* gdb_fread_cstr(gbfile* fin); -QString fread_cstr() +static QString fread_cstr() { QString rv; char* s = gdb_fread_cstr(fin); @@ -361,7 +361,7 @@ gdb_add_route_waypt(route_head* rte, Waypoint* ref, const int wpt_class) /*******************************************************************************/ /* TOOLS AND MACROS FOR THE WRITER */ /*-----------------------------------------------------------------------------*/ -void FWRITE_CSTR(QString a) { +static void FWRITE_CSTR(QString a) { if (a.isEmpty()) { gbfputc(0, fout); return; diff --git a/geo.cc b/geo.cc index eb368ccc4..a04d3bb1a 100644 --- a/geo.cc +++ b/geo.cc @@ -38,12 +38,12 @@ arglist_t geo_args[] = { #define MYNAME "geo" // This really should be class-local... -QXmlStreamReader reader; -QString geo_read_fname; +static QXmlStreamReader reader; +static QString geo_read_fname; -geocache_container wpt_container(const QString&); +static geocache_container wpt_container(const QString&); -void GeoReadLoc() +static void GeoReadLoc() { Waypoint* wpt = nullptr; QString current_tag; diff --git a/geojson.cc b/geojson.cc index 6a3032183..02d5137f8 100644 --- a/geojson.cc +++ b/geojson.cc @@ -58,7 +58,7 @@ geojson_rd_init(const QString& fname) { input_file_name = fname; } -QJsonArray* feature_collection = nullptr; +static QJsonArray* feature_collection = nullptr; static void geojson_wr_init(const QString& fname) { diff --git a/googledir.cc b/googledir.cc index 3add146cc..aa6a69834 100644 --- a/googledir.cc +++ b/googledir.cc @@ -63,7 +63,7 @@ goog_instr(xg_string args, const QXmlStreamAttributes*) static int goog_step = 0; -long +static long decode_goog64(const QByteArray& str, int& pos) { long result = 0; diff --git a/gopal.cc b/gopal.cc index f62f0fa1e..3b12daaba 100644 --- a/gopal.cc +++ b/gopal.cc @@ -65,7 +65,7 @@ static gbfile* fin, *fout; static struct tm tm,filenamedate, trackdate; -time_t tx; +static time_t tx; static char* optdate=nullptr; static char* optmaxspeed=nullptr; static char* optminspeed=nullptr; @@ -83,7 +83,7 @@ arglist_t gopal_args[] = { #define CHECK_BOOL(a) if (a && (*a == '0')) a = NULL -int gopal_check_line(char* line) +static int gopal_check_line(char* line) { char* c = line; int i = 0; diff --git a/gpx.cc b/gpx.cc index 2b9e6c672..5b6b7f3ab 100644 --- a/gpx.cc +++ b/gpx.cc @@ -47,7 +47,7 @@ static int logpoint_ct = 0; static int elevation_precision; // static char* gpx_version = NULL; -QString gpx_version; +static QString gpx_version; static char* gpx_wversion; static int gpx_wversion_num; static QXmlStreamAttributes gpx_namespace_attribute; @@ -303,7 +303,7 @@ typedef struct tag_mapping { {type, 0, "/gpx/" name}, \ {type, 0, "/gpx/metadata/" name} -tag_mapping tag_path_map[] = { +static tag_mapping tag_path_map[] = { { tt_gpx, 0, "/gpx" }, METATAG(tt_name, "name"), METATAG(tt_desc, "desc"), @@ -423,7 +423,7 @@ tag_mapping tag_path_map[] = { }; // Maintain a fast mapping from full tag names to the struct above. -QHash hash; +static QHash hash; static tag_type get_tag(const QString& t, int* passthrough) @@ -1345,7 +1345,7 @@ gpx_wr_deinit() mkshort_del_handle(&mkshort_handle); } -void +static void gpx_read() { for (bool atEnd = false; !reader->atEnd() && !atEnd;) { diff --git a/gtm.cc b/gtm.cc index fea8e60cf..985183ab8 100644 --- a/gtm.cc +++ b/gtm.cc @@ -72,7 +72,7 @@ fread_bool(gbfile* fd) #define fread_single(a) gbfgetflt(a) #define fread_double(a) gbfgetdbl(a) -QString +static QString fread_string(gbfile* fd) { char* val; @@ -99,7 +99,7 @@ fread_string_discard(gbfile* fd) fread_string(fd); } -QString +static QString fread_fixedstring(gbfile* fd, int len) { char* val = (char*) xmalloc(len+1); @@ -155,7 +155,7 @@ fwrite_string(gbfile* fd, const QString& str) } } -void +static void fwrite_fixedstring(gbfile* fd, const char* str, int fieldlen) { int len = str ? strlen(str) : 0; @@ -171,7 +171,7 @@ fwrite_fixedstring(gbfile* fd, const char* str, int fieldlen) } } -void +static void fwrite_fixedstring(gbfile* fd, const QString& str, int fieldlen) { fwrite_fixedstring(fd, CSTR(str), fieldlen); @@ -323,7 +323,7 @@ static const int indatum_array[MAX_INDATUM_INDEX] = { 116 // < 263 : Wake Eniwetok 1960 }; -void set_datum(int n) +static void set_datum(int n) { indatum = -1; if (n > 0 && n < MAX_INDATUM_INDEX) { @@ -380,7 +380,7 @@ static const char* icon_descr[] = { }; -void convert_datum(double* lat, double* lon) +static void convert_datum(double* lat, double* lon) { double amt; if (indatum != -1 && indatum != 118) { @@ -738,4 +738,4 @@ ff_vecs_t gtm_vecs = { CET_CHARSET_ASCII, 0, /* CET-REVIEW */ NULL_POS_OPS, nullptr -}; \ No newline at end of file +}; diff --git a/gtrnctr.cc b/gtrnctr.cc index 5e6cb281e..98d5a2856 100644 --- a/gtrnctr.cc +++ b/gtrnctr.cc @@ -451,7 +451,7 @@ gtc_crs_ftr(const route_head*) } -void +static void gtc_write() { gtc_write_xml(0, "\n"); diff --git a/holux.cc b/holux.cc index d83669c6d..3f04a9df5 100644 --- a/holux.cc +++ b/holux.cc @@ -154,7 +154,7 @@ static void data_read() -const char* mknshort(const char* stIn,unsigned int sLen) +static const char* mknshort(const char* stIn,unsigned int sLen) { #define MAX_STRINGLEN 255 static char strOut[MAX_STRINGLEN]; diff --git a/igo8.cc b/igo8.cc index c2d7e0127..d8a5c9510 100644 --- a/igo8.cc +++ b/igo8.cc @@ -238,7 +238,7 @@ static void write_igo8_track_point(const Waypoint* wpt) // Write src unicode str to the dst cstring using unicode characters // All lengths are in bytes -unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len) +static unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len) { // Check to see what length we were passed, if the length doesn't include the null // then we make it include the null @@ -277,7 +277,7 @@ unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* // string, validate that the use of the CET library provides // conmforming output, remove my old junk converter code. -unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src) +static unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src) { short* unicode; int len; @@ -292,7 +292,7 @@ unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, co return len; } -void write_header() +static void write_header() { char header[IGO8_HEADER_SIZE] = {'\0'}; igo8_id_block tmp_id_block; diff --git a/inifile.cc b/inifile.cc index 98cd51bb5..f24233d6a 100644 --- a/inifile.cc +++ b/inifile.cc @@ -49,7 +49,7 @@ typedef struct inifile_section_s { #define GPSBABEL_SUBDIR ".gpsbabel" /* Remember the filename we used so we can include it in errors. */ -QString gbinipathname; +static QString gbinipathname; static QString find_gpsbabel_inifile(const QString& path) /* can be empty or NULL */ diff --git a/interpolate.cc b/interpolate.cc index 538c104b3..9407ea4e8 100644 --- a/interpolate.cc +++ b/interpolate.cc @@ -28,9 +28,9 @@ #define MYNAME "Interpolate filter" static char* opt_interval = nullptr; -unsigned int interval = 0; +static unsigned int interval = 0; static char* opt_dist = nullptr; -double dist = 0; +static double dist = 0; static char* opt_route = nullptr; static @@ -52,7 +52,7 @@ arglist_t interpfilt_args[] = { ARG_TERMINATOR }; -void +static void interpfilt_process() { queue* backuproute = nullptr; @@ -172,7 +172,7 @@ interpfilt_process() xfree(backuproute); } -void +static void interpfilt_init(const char*) { diff --git a/itracku.cc b/itracku.cc index 64d34b25e..effa3c292 100644 --- a/itracku.cc +++ b/itracku.cc @@ -198,7 +198,7 @@ itracku_device_update_data_read(void* buf, int len) // mysterious, but not worth tracking down at this time. When xcode 4 comes // along (or anyone really cares about mega performance of this fairly obscure // target, we should revisit this. -double +static double deg_min_to_deg(volatile uint32_t x) { double sign; @@ -227,7 +227,7 @@ deg_min_to_deg(volatile uint32_t x) /* Convert degrees to the degrees format of itracku. */ -uint32_t +static uint32_t deg_to_deg_min(double x) { int32_t sign; @@ -324,7 +324,7 @@ to_itracku_data_record(const Waypoint* wp, itracku_data_record* d) Returns gbser_OK if the initialization is sucessful, a non-zero integer otherwise. */ -int +static int init_device() { int rc; diff --git a/kml.cc b/kml.cc index b03f5c565..164e5960b 100644 --- a/kml.cc +++ b/kml.cc @@ -604,7 +604,7 @@ kml_wr_position_deinit() } -void +static void kml_output_linestyle(char* /*color*/, int width) { // Style settings for line strings @@ -1904,7 +1904,7 @@ static void kml_route_tlr(const route_head* header) // For Earth 5.0 and later, we write a LookAt that encompasses // the bounding box of our entire data set and set the event times // to include all our data. -void kml_write_AbstractView() +static void kml_write_AbstractView() { double bb_size; @@ -1975,7 +1975,7 @@ void kml_mt_array_schema(const char* field_name, const char* display_name, writer->writeEndElement(); // Close gx:SimpleArrayField tag } -void kml_write() +static void kml_write() { const global_trait* traits = get_traits(); diff --git a/lmx.cc b/lmx.cc index fc0ba90ef..5bc2fa27e 100644 --- a/lmx.cc +++ b/lmx.cc @@ -33,8 +33,8 @@ static gbfile* ofd; static Waypoint* wpt_tmp; -QString urllink; -QString urllinkt; +static QString urllink; +static QString urllinkt; static char* binary = nullptr; #define MYNAME "lmx" diff --git a/magproto.cc b/magproto.cc index b35a6957b..ac91e13de 100644 --- a/magproto.cc +++ b/magproto.cc @@ -378,7 +378,7 @@ mag_handoff() magrxstate = mrs_handoff; } -void +static void mag_verparse(char* ibuf) { int prodid = mm_unknown; diff --git a/make-an1sym.pl b/make-an1sym.pl index 65ade95e3..b1dbb8d8d 100755 --- a/make-an1sym.pl +++ b/make-an1sym.pl @@ -276,7 +276,7 @@ print <<'END'; */ -struct defguid { +static struct defguid { GUID guid; const char *name; } default_guids[] = { @@ -287,7 +287,7 @@ sub print_footer { print <<'END'; }; -int FindIconByName( const char *name, GUID *guid ) { +static int FindIconByName( const char *name, GUID *guid ) { unsigned int i = 0; for ( i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++ ) { @@ -299,7 +299,7 @@ int FindIconByName( const char *name, GUID *guid ) { return 0; } -int FindIconByGuid( GUID *guid, char **name ) { +static int FindIconByGuid( GUID *guid, char **name ) { unsigned int i = 0; for ( i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++ ) { diff --git a/mapfactor.cc b/mapfactor.cc index e7a104d96..d292923d7 100644 --- a/mapfactor.cc +++ b/mapfactor.cc @@ -40,7 +40,7 @@ static const double milliarcseconds = 60.0 * 60.0 * 1000.0; geocache_container wpt_container(const QString&); -void MapfactorRead() +static void MapfactorRead() { Waypoint* wpt = nullptr; diff --git a/mapsend.cc b/mapsend.cc index 639ec547e..ccd6df035 100644 --- a/mapsend.cc +++ b/mapsend.cc @@ -402,7 +402,7 @@ mapsend_route_disp(const Waypoint* waypointp) gbfwrite(&c, 1, 1, mapsend_file_out); } -void mapsend_track_hdr(const route_head* trk) +static void mapsend_track_hdr(const route_head* trk) { /* * we write mapsend v3.0 tracks as mapsend v2.0 tracks get @@ -452,7 +452,7 @@ void mapsend_track_hdr(const route_head* trk) } -void mapsend_track_disp(const Waypoint* wpt) +static void mapsend_track_disp(const Waypoint* wpt) { unsigned char c; int32_t t; @@ -502,7 +502,7 @@ void mapsend_track_disp(const Waypoint* wpt) } } -void +static void mapsend_track_write() { track_disp_all(mapsend_track_hdr, mapsend_noop, mapsend_track_disp); diff --git a/mapsource.cc b/mapsource.cc index d2ecb031d..916046cad 100644 --- a/mapsource.cc +++ b/mapsource.cc @@ -112,13 +112,13 @@ mps_noop(const route_head*) /* no-op */ } -void +static void mps_wpt_q_init(queue* whichQueue) { QUEUE_INIT(whichQueue); } -void +static void mps_wpt_q_deinit(queue* whichQueue) { queue* elem, *tmp; @@ -133,7 +133,7 @@ mps_wpt_q_deinit(queue* whichQueue) * Find a waypoint that we've already written out * */ -Waypoint* +static Waypoint* mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name) { queue* elem, *tmp; @@ -152,7 +152,7 @@ mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name) * Add a waypoint that we've already written out to our list * */ -void +static void mps_wpt_q_add(const queue* whichQueue, const Waypoint* wpt) { Waypoint* written_wpt = new Waypoint(*wpt); @@ -1812,7 +1812,7 @@ mps_read() } -void +static void mps_write() { int short_length; diff --git a/mtk_locus.cc b/mtk_locus.cc index dd583cd5b..e80584614 100644 --- a/mtk_locus.cc +++ b/mtk_locus.cc @@ -51,7 +51,7 @@ static char* opt_erase; static char* opt_status; static char* opt_enable; -arglist_t mtk_locus_args[] = { +static arglist_t mtk_locus_args[] = { {"baudrate", &opt_baudrate, "Speed in bits per second of serial port (autodetect=0)", "0", ARGTYPE_INT, ARG_NOMINMAX , nullptr}, {"download", &opt_download, "Download logged fixes", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, {"erase", &opt_erase, "Erase device data after download", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, diff --git a/mtk_logger.cc b/mtk_logger.cc index b329fad1b..3783f4d83 100644 --- a/mtk_logger.cc +++ b/mtk_logger.cc @@ -158,7 +158,7 @@ enum { DISTANCE, } /* DATA_TYPES */; -struct log_type { +static struct log_type { int id; int size; const char* name; @@ -189,7 +189,7 @@ struct log_type { struct sat_info { char id, used; short elevation, azimut, snr; -} sat_info; +}; struct data_item { time_t timestamp; @@ -207,14 +207,14 @@ struct data_item { unsigned short timestamp_ms; double distance; struct sat_info sat_data[32]; -} data_item; +}; struct mtk_loginfo { unsigned int bitmask; int logLen; int period, distance, speed; /* in 10:ths of sec, m, km/h */ int track_event; -} mtk_loginfo; +}; /* *************************************** */ @@ -241,7 +241,7 @@ static char* csv_file; /* csv ? command option */ static char* OPT_block_size_kb; /* block_size_kb ? command option */ static enum MTK_DEVICE_TYPE mtk_device = MTK_LOGGER; -struct mtk_loginfo mtk_info; +static struct mtk_loginfo mtk_info; const char LIVE_CHAR[4] = {'-', '\\','|','/'}; @@ -1123,7 +1123,7 @@ static int csv_line(gbfile* csvFile, int idx, unsigned long bmask, struct data_i /********************* MTK Logger -- Parse functions *********************/ -int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask) +static int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask) { static int count = 0; int i, k, sat_id, hspd; diff --git a/nmea.cc b/nmea.cc index fb2120ec5..fb0cd7209 100644 --- a/nmea.cc +++ b/nmea.cc @@ -197,7 +197,7 @@ static int had_checksum; static Waypoint* nmea_rd_posn(posn_status*); static void nmea_rd_posn_init(const QString& fname); -arglist_t nmea_args[] = { +static arglist_t nmea_args[] = { {"snlen", &snlenopt, "Max length of waypoint name to write", "6", ARGTYPE_INT, "1", "64", nullptr }, {"gprmc", &opt_gprmc, "Read/write GPRMC sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, {"gpgga", &opt_gpgga, "Read/write GPGGA sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, @@ -772,7 +772,7 @@ double pcmpt_deg(int d) return (double) deg + minutes; } -void +static void pcmpt_parse(char* ibuf) { int i, j1, j2, j3, j4, j5, j6; @@ -926,7 +926,7 @@ notalkerid_strmatch(const char * s1, const char *sentenceFormatterMnemonicCode) return strncmp(s1,"$",1) || strncmp(s1+3,sentenceFormatterMnemonicCode,3) || strncmp(s1+6,",",1); } -void +static void nmea_parse_one_line(char* ibuf) { char* ck; @@ -1252,13 +1252,13 @@ nmea_wayptpr(const Waypoint* wpt) gb_sleep(sleepus); } } -void +static void nmea_track_init(const route_head*) { last_time = -1; } -void +static void nmea_trackpt_pr(const Waypoint* wpt) { char obuf[200]; diff --git a/ozi.cc b/ozi.cc index 9ff9eee48..2f8e1f409 100644 --- a/ozi.cc +++ b/ozi.cc @@ -151,7 +151,7 @@ ozi_alloc_fsdata() return fsdata; } -void +static void ozi_get_time_str(const Waypoint* waypointp, char* buff, gbsize_t buffsz) { if (waypointp->creation_time.isValid()) { @@ -162,7 +162,7 @@ ozi_get_time_str(const Waypoint* waypointp, char* buff, gbsize_t buffsz) } } -void +static void ozi_set_time_str(const QString& str, Waypoint* waypointp) { double ozi_time = str.toDouble(); diff --git a/pcx.cc b/pcx.cc index 5daa6da48..935629755 100644 --- a/pcx.cc +++ b/pcx.cc @@ -356,7 +356,7 @@ static void pcx_route_hdr(const route_head* rte) { ";waypts\n"); } -void pcx_track_disp(const Waypoint* wpt) { +static void pcx_track_disp(const Waypoint* wpt) { double lon, lat; lon = degrees2ddmm(wpt->longitude); diff --git a/pocketfms_wp.cc b/pocketfms_wp.cc index 5c3d9cf14..5c6d1f1b8 100644 --- a/pocketfms_wp.cc +++ b/pocketfms_wp.cc @@ -33,7 +33,7 @@ rd_init(const QString& fname) file_in = gbfopen_le(fname, "r", MYNAME); } -double wppos_to_dec(char* value) +static double wppos_to_dec(char* value) { if (strstr(value, "\xB0") == nullptr) { return atof(value); diff --git a/polygon.cc b/polygon.cc index 1f4ade8b9..98dec26e4 100644 --- a/polygon.cc +++ b/polygon.cc @@ -233,7 +233,7 @@ static void polytest(double lat1, double lon1, #define BADVAL 999999 -void +static void polygon_process() { queue* elem, * tmp; @@ -340,13 +340,13 @@ polygon_process() } } -void +static void polygon_init(const char*) { /* do nothing */ } -void +static void polygon_deinit() { /* do nothing */ diff --git a/position.cc b/position.cc index 5d532e272..82fd98cb7 100644 --- a/position.cc +++ b/position.cc @@ -200,7 +200,7 @@ position_noop_t(const route_head*) { } -void position_process() +static void position_process() { int i = waypt_count(); @@ -212,7 +212,7 @@ void position_process() track_disp_all(position_process_trk, position_noop_t, position_noop_w); } -void +static void position_init(const char*) { char* fm; @@ -236,7 +236,7 @@ position_init(const char*) } } -void +static void position_deinit() { } diff --git a/psitrex.cc b/psitrex.cc index 74713c17c..b0fec479f 100644 --- a/psitrex.cc +++ b/psitrex.cc @@ -51,7 +51,7 @@ static int psit_track_state = 2; static char psit_current_token[256]; -char* snlen; +static char* snlen; static arglist_t psit_args[] = { @@ -753,7 +753,7 @@ psit_noop(const route_head*) /* no-op */ } -void +static void psit_write() { int short_length; diff --git a/radius.cc b/radius.cc index a999f5bff..3d29df98e 100644 --- a/radius.cc +++ b/radius.cc @@ -108,7 +108,7 @@ dist_comp(const void* a, const void* b) } -void +static void radius_process() { #if !NEWQ @@ -202,7 +202,7 @@ radius_process() xfree(comp); } -void +static void radius_init(const char*) { char* fm; @@ -234,7 +234,7 @@ radius_init(const char*) } } -void +static void radius_deinit() { if (home_pos) { diff --git a/reverse_route.cc b/reverse_route.cc index f92848055..a564b3669 100644 --- a/reverse_route.cc +++ b/reverse_route.cc @@ -48,21 +48,21 @@ static void reverse_route_wpt(const Waypoint* waypointp) prev_new_trkseg = curr_new_trkseg; } -void +static void reverse_route_head(const route_head* rte) { route_reverse(rte); prev_new_trkseg = 1; } -void +static void reverse_route_process() { track_disp_all(reverse_route_head, nullptr, reverse_route_wpt); route_disp_all(reverse_route_head, nullptr, nullptr); } -void +static void reverse_route_init(const char*) { switch (global_opts.objective) { @@ -76,7 +76,7 @@ reverse_route_init(const char*) } } -void +static void reverse_route_deinit() { /* do nothing */ diff --git a/saroute.cc b/saroute.cc index fc17691ae..d1cc2ff7d 100644 --- a/saroute.cc +++ b/saroute.cc @@ -25,15 +25,15 @@ #include "grtcirc.h" #include -gbfile* infile; +static gbfile* infile; -char* turns_important = nullptr; -char* turns_only = nullptr; -char* controls = nullptr; -char* split = nullptr; -char* timesynth = nullptr; +static char* turns_important = nullptr; +static char* turns_only = nullptr; +static char* controls = nullptr; +static char* split = nullptr; +static char* timesynth = nullptr; -int control = 0; +static int control = 0; static arglist_t saroute_args[] = { @@ -64,7 +64,7 @@ arglist_t saroute_args[] = { #define ReadShort(f) gbfgetint16(f) #define ReadLong(f) gbfgetint32(f) -unsigned char* +static unsigned char* ReadRecord(gbfile* f, gbsize_t size) { unsigned char* result = (unsigned char*) xmalloc(size); @@ -73,7 +73,7 @@ ReadRecord(gbfile* f, gbsize_t size) return result; } -void +static void Skip(gbfile* f, gbsize_t distance) { gbfseek(f, distance, SEEK_CUR); diff --git a/shape.cc b/shape.cc index 56396db35..1cdeb280d 100644 --- a/shape.cc +++ b/shape.cc @@ -64,7 +64,7 @@ arglist_t shp_args[] = { /* SHPOpenGpsbabel() */ /************************************************************************/ -SHPHandle SHPAPI_CALL +static SHPHandle SHPAPI_CALL SHPOpenGpsbabel(const QString& pszLayer, const char* pszAccess) { @@ -87,7 +87,7 @@ SHPOpenGpsbabel(const QString& pszLayer, const char* pszAccess) /* shape file with read/write access. */ /************************************************************************/ -SHPHandle SHPAPI_CALL +static SHPHandle SHPAPI_CALL SHPCreateGpsbabel(const QString& pszLayer, int nShapeType) { @@ -109,7 +109,7 @@ SHPCreateGpsbabel(const QString& pszLayer, int nShapeType) /* Open a .dbf file. */ /************************************************************************/ -DBFHandle SHPAPI_CALL +static DBFHandle SHPAPI_CALL DBFOpenGpsbabel(const QString& pszFilename, const char* pszAccess) { @@ -131,7 +131,7 @@ DBFOpenGpsbabel(const QString& pszFilename, const char* pszAccess) /* Create a new .dbf file. */ /************************************************************************/ -DBFHandle SHPAPI_CALL +static DBFHandle SHPAPI_CALL DBFCreateExGpsbabel(const QString& pszFilename, const char* pszCodePage) { @@ -147,18 +147,20 @@ DBFCreateExGpsbabel(const QString& pszFilename, const char* pszCodePage) } +#ifdef DEAD_CODE_IS_REBORN /************************************************************************/ /* DBFCreateGpsbabel() */ /* */ /* Create a new .dbf file with default code page LDID/87 (0x57) */ /************************************************************************/ -DBFHandle SHPAPI_CALL +static DBFHandle SHPAPI_CALL DBFCreateGpsbabel(const QString& pszFilename) { return DBFCreateExGpsbabel(pszFilename, "LDID/87"); // 0x57 } +#endif static void dump_fields(void) @@ -220,7 +222,7 @@ my_rd_init(const QString& fname) } } -void +static void my_read(void) { // option processing here instead of in my_rd_init @@ -396,7 +398,7 @@ err: } -void +static void my_rd_deinit(void) { SHPClose(ihandle); @@ -404,13 +406,13 @@ my_rd_deinit(void) ifname.clear(); } -void +static void my_wr_init(const QString& fname) { ofname = fname; } -void +static void my_wr_deinit(void) { SHPClose(ohandle); @@ -418,7 +420,7 @@ my_wr_deinit(void) ofname.clear(); } -void +static void my_write_wpt(const Waypoint* wpt) { SHPObject* shpobject; @@ -437,7 +439,7 @@ my_write_wpt(const Waypoint* wpt) CSTR(wpt->shortname)); } -void +static void poly_init(const route_head* rte) { const int ct = rte->rte_waypt_ct; @@ -448,7 +450,7 @@ poly_init(const route_head* rte) } -void +static void poly_point(const Waypoint* wpt) { polybufx[poly_count] = wpt->longitude; @@ -457,7 +459,7 @@ poly_point(const Waypoint* wpt) poly_count++; } -void +static void poly_deinit(const route_head* rte) { SHPObject* shpobject; @@ -478,7 +480,7 @@ poly_deinit(const route_head* rte) } -void +static void my_write(void) { // shape files can only contain one shape type in addition diff --git a/skytraq.cc b/skytraq.cc index acc1ac279..ff3f9a921 100644 --- a/skytraq.cc +++ b/skytraq.cc @@ -256,9 +256,9 @@ wr_buf(const unsigned char* str, int len) * %%% SkyTraq protocol implementation %%% * *******************************************************************************/ -uint8_t NL[2] = { 0x0D, 0x0A }; -uint8_t MSG_START[2] = { 0xA0, 0xA1 }; -uint8_t SECTOR_READ_END[13] = { 'E','N','D', 0, 'C','H','E','C','K','S','U','M','=' }; +static uint8_t NL[2] = { 0x0D, 0x0A }; +static uint8_t MSG_START[2] = { 0xA0, 0xA1 }; +static uint8_t SECTOR_READ_END[13] = { 'E','N','D', 0, 'C','H','E','C','K','S','U','M','=' }; static int skytraq_calc_checksum(const unsigned char* buf, int len) @@ -1469,7 +1469,7 @@ static char* opt_set_poi_car = nullptr; /* set if a "poi" option was used */ static char* opt_set_poi_boat = nullptr; /* set if a "poi" option was used */ static char* opt_set_poi_heart = nullptr; /* set if a "poi" option was used */ static char* opt_set_poi_bar = nullptr; /* set if a "poi" option was used */ -arglist_t miniHomer_args[] = { +static arglist_t miniHomer_args[] = { { "baud", &opt_dlbaud, "Baud rate used for download", "115200", ARGTYPE_INT, "0", "115200", nullptr }, { "dump-file", &opt_dump_file, "Dump raw data to this file", nullptr, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr }, { "erase", &opt_erase, "Erase device data after download", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, @@ -1492,7 +1492,8 @@ static const char* poinames[] = { "Home", "Car", "Boat", "Heart", "Bar" }; #define NUMPOI (sizeof poinames/sizeof poinames[0]) -int getPoiByName(char* name) +#ifdef DEAD_CODE_IS_REBORN +static int getPoiByName(char* name) { unsigned int i; for (i=0; iintermed); @@ -129,7 +129,7 @@ static int xte_count = 0; static const route_head* cur_rte = nullptr; static struct xte* xte_recs = nullptr; -void +static void routesimple_waypt_pr(const Waypoint* wpt) { if (!cur_rte) { @@ -148,7 +148,7 @@ routesimple_waypt_pr(const Waypoint* wpt) xte_count++; } -void +static void compute_xte(struct xte* xte_rec) { const Waypoint* wpt3 = xte_rec->intermed->wpt; @@ -210,7 +210,7 @@ compute_xte(struct xte* xte_rec) } -int +static int compare_xte(const void* a, const void* b) { double distdiff = ((struct xte*)a)->distance - @@ -241,7 +241,7 @@ compare_xte(const void* a, const void* b) return 0; } -void +static void routesimple_head(const route_head* rte) { cur_rte = nullptr; @@ -265,7 +265,7 @@ routesimple_head(const route_head* rte) } -void +static void shuffle_xte(struct xte* xte_rec) { struct xte tmp_xte; @@ -300,7 +300,7 @@ shuffle_xte(struct xte* xte_rec) } } -void +static void routesimple_tail(const route_head* rte) { int i; @@ -372,7 +372,7 @@ routesimple_tail(const route_head* rte) xfree(xte_recs); } -void +static void routesimple_process() { waypt_del_fnp = route_del_wpt; @@ -382,7 +382,7 @@ routesimple_process() track_disp_all(routesimple_head, routesimple_tail, routesimple_waypt_pr); } -void +static void routesimple_init(const char*) { count = 0; @@ -410,7 +410,7 @@ routesimple_init(const char*) } } -void +static void routesimple_deinit() { /* do nothing */ diff --git a/sort.cc b/sort.cc index 6d51336d8..b4ff6b00c 100644 --- a/sort.cc +++ b/sort.cc @@ -32,7 +32,7 @@ typedef enum { sm_time } sort_mode_; -sort_mode_ sort_mode = sm_shortname; /* How are we sorting these? */ +static sort_mode_ sort_mode = sm_shortname; /* How are we sorting these? */ static char* opt_sm_gcid, *opt_sm_shortname, *opt_sm_description, *opt_sm_time; @@ -78,13 +78,13 @@ sort_comp(const queue* a, const queue* b) } } -void +static void sort_process() { sortqueue(&waypt_head, sort_comp); } -void +static void sort_init(const char*) { if (opt_sm_gcid) { diff --git a/stackfilter.cc b/stackfilter.cc index d66f52287..a774df786 100644 --- a/stackfilter.cc +++ b/stackfilter.cc @@ -80,7 +80,7 @@ arglist_t stackfilt_args[] = { ARG_TERMINATOR }; -struct stack_elt { +static struct stack_elt { queue waypts; queue routes; queue tracks; @@ -91,7 +91,7 @@ struct stack_elt { }* stack = nullptr; -void +static void stackfilt_process() { struct stack_elt* tmp_elt = nullptr; @@ -191,7 +191,7 @@ stackfilt_process() } } -void +static void stackfilt_init(const char*) { @@ -231,13 +231,13 @@ stackfilt_init(const char*) } -void +static void stackfilt_deinit() { swapdepth = 0; } -void +static void stackfilt_exit() { struct stack_elt* tmp_elt = nullptr; diff --git a/subrip.cc b/subrip.cc index 61bc2fffd..da20ca93b 100644 --- a/subrip.cc +++ b/subrip.cc @@ -262,7 +262,7 @@ subrip_write() /* arguments: definitions of format-specific arguments */ -arglist_t subrip_args[] = { +static arglist_t subrip_args[] = { // FIXME: document that gps_date and gps_time must be specified together or they will both be ignored and the timestamp of the first trackpoint will be used. {"video_time", &opt_videotime, "Video position for which exact GPS time is known (hhmmss, default is 0:00:00)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, {"gps_time", &opt_gpstime, "GPS time at position video_time (hhmmss, default is first timestamp of track)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, diff --git a/tomtom.cc b/tomtom.cc index 68485c861..d8e355132 100644 --- a/tomtom.cc +++ b/tomtom.cc @@ -80,10 +80,11 @@ wr_deinit() #define read_long(f) gbfgetint32((f)) #define read_char(f) gbfgetc((f)) +#ifdef DEAD_CODE_IS_REBORN /* * Decode a type 8 compressed record */ -char* +static char* decode_8(int sz, const unsigned char* inbuf) { static const char encoding_8[] = "X. SaerionstldchumgpbkfzvACBMPG-"; @@ -122,8 +123,10 @@ decode_8(int sz, const unsigned char* inbuf) } return rval; } +#endif -void +#ifdef DEAD_CODE_IS_REBORN +static void decode_latlon(double* lat, double* lon) { unsigned char latbuf[3]; @@ -138,6 +141,7 @@ decode_latlon(double* lat, double* lon) *lon = rlon = 123.456; } +#endif static void check_recsize(int sz) diff --git a/tpo.cc b/tpo.cc index d2901e9ec..2fec96f3f 100644 --- a/tpo.cc +++ b/tpo.cc @@ -132,7 +132,7 @@ static double last_waypoint_z; /*******************************************************************************/ /* Define a global here that we can query from multiple places */ -float tpo_version = 0.0; +static float tpo_version = 0.0; /* tpo_check_version_string() Check the first bytes of the file for a version 3.0 header. */ @@ -256,7 +256,7 @@ tpo_read_until_section(const char* section_name, int seek_bytes) // that is the only type of data available in the version 2.x TPO // files. // -void tpo_read_2_x() +static void tpo_read_2_x() { char buff[16]; short track_count, waypoint_count; @@ -376,7 +376,7 @@ void tpo_read_2_x() // // For version 3.x files. // -int tpo_read_int() +static int tpo_read_int() { unsigned char val; @@ -416,7 +416,7 @@ int tpo_read_int() // // For version 3.x files. // -int tpo_find_block(unsigned int block_desired) +static int tpo_find_block(unsigned int block_desired) { unsigned int block_type; unsigned int block_offset; @@ -453,7 +453,7 @@ int tpo_find_block(unsigned int block_desired) // // For version 3.x files. // -Waypoint* tpo_convert_ll(int lat, int lon) +static Waypoint* tpo_convert_ll(int lat, int lon) { double latitude; double longitude; @@ -510,7 +510,7 @@ public: // Track decoder for version 3.x files. This block contains tracks // (called "freehand routes" or just "routes" in Topo). // -void tpo_process_tracks() +static void tpo_process_tracks() { unsigned int track_count, track_style_count; unsigned int xx,ii,tmp; @@ -812,12 +812,12 @@ void tpo_process_tracks() // // For version 3.x files. // -Waypoint** tpo_wp_index; -unsigned int tpo_index_ptr; +static Waypoint** tpo_wp_index; +static unsigned int tpo_index_ptr; // Waypoint decoder for version 3.x files. // -void tpo_process_waypoints() +static void tpo_process_waypoints() { unsigned int waypoint_count; unsigned int ii; @@ -938,7 +938,7 @@ void tpo_process_waypoints() // Map Notes decoder for version 3.x files. // -void tpo_process_map_notes() +static void tpo_process_map_notes() { unsigned int waypoint_count; unsigned int ii; @@ -1055,7 +1055,7 @@ void tpo_process_map_notes() // Symbols decoder for version 3.x files. // -void tpo_process_symbols() +static void tpo_process_symbols() { unsigned int waypoint_count; unsigned int ii; @@ -1110,7 +1110,7 @@ void tpo_process_symbols() // Text Labels decoder for version 3.x files. // -void tpo_process_text_labels() +static void tpo_process_text_labels() { unsigned int waypoint_count; unsigned int ii; @@ -1185,7 +1185,7 @@ void tpo_process_text_labels() // with pointers to waypoint objects by tpo_process_waypoints() // function above. // -void tpo_process_routes() +static void tpo_process_routes() { unsigned int route_count; unsigned int ii; @@ -1280,13 +1280,15 @@ void tpo_process_routes() +#ifdef DEAD_CODE_IS_REBORN // Compass decoder for version 3.x files. // -void tpo_process_compass() +static void tpo_process_compass() { // Not implemented yet } +#endif @@ -1296,7 +1298,7 @@ void tpo_process_compass() // (called "freehand routes" or just "routes" in Topo), "waypoints", // and "gps-routes". We intend to read all three types. // -void tpo_read_3_x() +static void tpo_read_3_x() { if (doing_trks) { diff --git a/v900.cc b/v900.cc index 4ec816ba0..aaa680ebf 100644 --- a/v900.cc +++ b/v900.cc @@ -182,7 +182,7 @@ v900_rd_deinit() } /* copied from dg-100.c - slight (incompatible) modification to how the date parameter is used */ -QDateTime +static QDateTime bintime2utc(int date, int time) { int secs = time % 100; time /= 100; diff --git a/validate.cc b/validate.cc index 61a3ec188..2aa67434f 100644 --- a/validate.cc +++ b/validate.cc @@ -28,9 +28,9 @@ #define MYNAME "validate" static char* opt_debug; -bool debug; +static bool debug; static char* opt_checkempty; -bool checkempty; +static bool checkempty; static unsigned int point_ct; static unsigned int head_ct; static unsigned int segment_ct_start; diff --git a/vpl.cc b/vpl.cc index 426509f69..48f343bc9 100644 --- a/vpl.cc +++ b/vpl.cc @@ -111,7 +111,7 @@ C - Checksum #define MYNAME "vpl" -void vpl_parse_75_sentence(const char*); +static void vpl_parse_75_sentence(const char*); static arglist_t vpl_args[] = { diff --git a/wfff_xml.cc b/wfff_xml.cc index 19a2c7fbc..67ad63f30 100644 --- a/wfff_xml.cc +++ b/wfff_xml.cc @@ -199,7 +199,7 @@ void wfff_e(xg_string, const QXmlStreamAttributes*) } } -void +static void wfff_xml_rd_init(const QString& fname) { tosscount = 0; @@ -208,13 +208,13 @@ wfff_xml_rd_init(const QString& fname) } void -wfff_xml_read() +static wfff_xml_read() { xml_read(); } void -wfff_xml_rd_deinit() +static wfff_xml_rd_deinit() { xml_deinit(); -- 2.30.2